<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
	<ui:composition template="template/template.xhtml">
		<ui:define  name="page-title" >#{messages.mercadorias}</ui:define >
		<ui:define  name="center">
			<p:commandButton action="#{mercadoriaController.novoMaterial}" value="#{messages.novoMaterial}"  ajax="false"/>
           	<p:dataTable id="tabelaMateriais" var="material" value="#{mercadoriaController.materials}"  
	                 paginator="true" rows="10"  paginatorPosition="bottom"
	                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} "  
	                 rowsPerPageTemplate="5,10,15">  
	        
		        <f:facet name="header">  
		           	#{messages.materiais}
		        </f:facet>  
		  
		        <p:column>  
		            <f:facet name="header">  
		                <h:outputText value="#{messages.id}" />  
		            </f:facet>  
		            <h:outputText value="#{material.id}" />  
		        </p:column>  
		  
		        <p:column>  
		            <f:facet name="header">  
		                <h:outputText value="#{messages.categoria}" />  
		            </f:facet>  
		            <h:outputText value="#{material.categoria.nome}" />  
		        </p:column>  
		  
		        <p:column>  
		            <f:facet name="header">  
		                <h:outputText value="#{messages.nome}" />  
		            </f:facet>  
		            <h:outputText value="#{material.nome}" />  
		        </p:column>  
		        
		        <p:column>  
		            <f:facet name="header">  
		                <h:outputText value="#{messages.limite}" />  
		            </f:facet>  
		            <h:outputText value="#{material.limite}" />  
		        </p:column>
		  
		        <p:column>  
		            <f:facet name="header">  
		                <h:outputText value="#{messages.preco}" />  
		            </f:facet>  
		            <h:outputText value="#{material.preco}" />  
		        </p:column>
		        
		        <p:column style="width:40px">  
		            <p:commandLink action="material" style="display: inline-block" styleClass="ui-icon ui-icon-search"  ajax="false">
		            	<f:param name="materialId" value="#{material.id}" />
		            </p:commandLink>
		        </p:column>
		        
		        
		    </p:dataTable>
		</ui:define >
	</ui:composition>
	
</html>